package com.fzhucc.modules.displayMap.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @description /
 * @author yyg
 * @date 2022-10-25
 **/
@Entity
@Data
@Table(name="tb_display_map")
public class DisplayMap implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "位置名(简短)")
    private String name;

    @Column(name = "`address`")
    @ApiModelProperty(value = "详细地址")
    private String address;

    @Column(name = "`longitude`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "经度")
    private Double longitude;

    @Column(name = "`latitude`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "纬度")
    private Double latitude;

    @Column(name = "`contract`")
    @ApiModelProperty(value = "联系人")
    private String contract;

    @Column(name = "`phone`")
    @ApiModelProperty(value = "联系方式")
    private String phone;

    @Column(name = "`type`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "分类")
    private String type;

    @Column(name = "`is_show`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否显示默认显示")
    private Integer isShow;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "地区划分 即什么地区看的到什么地区的数据,省的看到全部")
    @Column(name = "`org_area`",nullable = false)
    @NotNull
    public String orgArea;

    public void copy(DisplayMap source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
